<#include "/common/head.ftl">

<@showTitle title="${i18n.getMessage('moveUpTest')} > ${i18n.getMessage('searchResult')}">
	<a href="#" onclick="editAll()">${i18n.getMessage('editAll')}</a>
	- <a href="#" onclick="cc('student/showSearchMoveUpTest.sgt')">${i18n.getMessage('search')}</a>
</@showTitle>

<br/>

<div id="error" style="display:none"></div>

<form id="form" validator="student/validateMoveUpTest.sgt">
	<input type="hidden" name="editAll" value="true"/>

	<@display.table id="listTable" name="moveUpTests" sort="list" pagesize="20" >
		<@display.column title="${i18n.getMessage('lastName')}" property="student.lastName" sortable="true"></@display.column>
		<@display.column title="${i18n.getMessage('firstName')}" sortable="true" style="width:70px"><a  <#if listTable.valid>style="color:red"</#if>   onmouseover="showMessage(event, '${listTable.id}')" onmouseout="hideTooltip()" onclick="hideTooltip();cc('student/showInfoStudent.sgt?id=${listTable.student.id}')">${(listTable.student.firstName)!}</a> <input type="hidden" name="ids" value="${listTable.id}"/></@display.column>
		<@display.column title="${i18n.getMessage('level')}" sortable="true" style="width:150px;text-align:center">
			<select name="levelIds" id="levelId" style="width:150px">
						<option></option>
						<#list programs as program>
							${request.setAttribute("levels", program.levels)}
							<optgroup label="${program.name}">
								<#list levels as level>
									<option value="${level.id}" <#if (level = (listTable.level)!)>selected</#if>>${level.name}</option>
								</#list>
							</optgroup>
						</#list>
			</select>
		</@display.column>
		<@display.column title="${i18n.getMessage('testDate')}" sortable="true" style="width:120px;text-align:center"><input name="dates" value="${(listTable.date?date)!}" style="width:80px;text-align:center"/><img class="calendarImg" src="images/calendar/calendar.gif" onclick="displayCalendar(this.previousSibling, '${i18n.getMessage('format.date')}', this)"/></@display.column>
		<@display.column title="${i18n.getMessage('writtenScore')}" sortable="true" style="text-align:center" style="width:60px"><input name="writtenScores" value="${(listTable.writtenScore)!}" style="text-align:center;width:60px"/></@display.column>
		<@display.column title="${i18n.getMessage('speakingScore')}" sortable="true" style="text-align:center" style="width:60px"><input name="speakingScores" value="${(listTable.speakingScore)!}" style="text-align:center;width:60px"/></@display.column>
		<@display.column title="${i18n.getMessage('edit')}" style="text-align:center"><img src="images/edit.gif" onclick="cc('student/showInfoMoveUpTest.sgt?id=${listTable.id}')" style="cursor:pointer"/></@display.column>
		<@display.column title="${i18n.getMessage('report')}" style="width:50px;text-align:center"><img src="images/report.gif" style="cursor:pointer"/></@display.column>
	</@display.table>

</form>

<br/><br/>

<script>
	
	showMessage = function(e, moveUpTestId) {
		dhtmlgoodies_tooltipMinWidth = 400;
		showTooltip(e, "loading...");
		loadata('dhtmlgoodies_tooltip', 'student/showDetailMoveUpTest.sgt?id=' + moveUpTestId);
	}
	
	editAll = function() {
		var form = $('form');
		submitFormValidation0(form, submitEditAll);
	}
	
	submitEditAll = function() {
		new Ajax.Request('student/editPlacementTests.sgt'.appendURL(Form.serialize($('form'))), { method:'get' });
		$('error').style.display = 'none';
	}
</script>